package cn.zf;

import java.util.Random;
import java.util.regex.Pattern;

public class Zehe {
    public static void main(String[] args) {
        //123456789中间随机插入” “，”+“，”-“和等于100实现
        Random r=new Random();
        String[] o={"","+","-"};
        StringBuilder sbu=new StringBuilder("1");
        while (true) {
            for (int i = 2; i <9; i++) {
                sbu.append(String.format("%s%d", o[r.nextInt(o.length)], i));
            }
            sbu.append("9");
            if(is(sbu.toString())){
                System.out.println(sbu.toString()+"=100");
                break;
            }
            sbu.delete(0,sbu.length());
            sbu.append("1");
        }
    }
    public static boolean is(String s){
        boolean f=false;
        var str= Pattern.compile("[+-]?\\d+");
        var m=str.matcher(s);
        int sum=0;
        while (m.find()){
            sum+=Integer.parseInt(m.group());
        }
        if(sum==100) f=true;
        return f;
    }
}
